package com.afiorenza.two.impl;

import com.afiorenza.two.Generator;


public class FibonnaciGenerator implements Generator {

	private long last1 = 1;
	private long last2 = 1;
	private long last = 1;
	private long count = 0;

	@Override
	public long next() {
		if (count < 2) {
			count++;
			return 1;
		} else {
			last = last1 + last2;
			last2 = last1;
			last1 = last;
			return last;
		}
	}
}